package top.malaoshi.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.malaoshi.entity.Comment;
import top.malaoshi.mapper.ICommentMapper;
import top.malaoshi.mapper.IGoodsMapper;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class CommentSrvImpl {

    @Resource
    private ICommentMapper dao;

//    public List<Comment> queryByGoodsId(String goodsId) {
//        List<Comment> list=dao.queryByGoodsId(goodsId);
//        return list;
//    }
    public PageInfo<Comment> queryByGoodsId(String goodsId,int pageNum,int pageSize) {
        Page page= PageHelper.startPage(pageNum, pageSize, true);
        List<Comment> list=dao.queryByGoodsId(goodsId);
        PageInfo<Comment> pageInfo=new PageInfo<Comment>(list,page.getPages());
        return pageInfo;
    }


}
